package com.dingding.order.facade.common.distance;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import com.dingding.common.core.base.dto.ResponseEntity;
import com.dingding.order.common.dto.distance.ReqCalculationDTO;
import com.dingding.order.common.dto.distance.ReqRealTimeCalculationDTO;
import com.dingding.order.common.dto.distance.ResCalculationDTO;
import com.dingding.order.common.dto.distance.ResRealTimeCalculationDTO;
import com.dingding.order.core.common.distance.service.ICalculateService;

/**
 * 
 * @ClassName: CalculationFacadeImpl 
 * @Description: 计算服务接口实现类
 * @author YHQ
 * @date 2016年12月7日 下午1:39:47
 * @since V2.5.7
 * 
 */
@Component("calculationFacade")
public class CalculationFacadeImpl implements ICalculationFacade{

	private Logger log = Logger.getLogger(this.getClass());
	
	@Resource(name = "calculateService")
	private ICalculateService calculateService;
	
	/**
	 * 
	 * @Title: calculationMileageCost 
	 * @Description: 计算距离、费用(专车、出租车)
	 * @param reqCalculationDTO 客户端请求参数 
	 * @author YHQ 
	 * @return ResponseEntity<ResCalculationDTO> 响应给客户端的数据Bean
	 * @since V2.5.7
	 * 
	 */
	@Override
	public ResponseEntity<ResCalculationDTO> calculationMileageCost(ReqCalculationDTO reqCalculationDTO,ResponseEntity<ResCalculationDTO> responseEntity) {
		
		try {
			return calculateService.calculationMileageCost(reqCalculationDTO,responseEntity);
		} catch (Exception e) {
			log.error("计算距离、费用(专车、出租车)时出现异常   类：" + this.getClass() + " calculationMileageCost()", e);
		}
		
		return null;
	}

	/**
	 * 
	 * @Title: realTimeCalculation 
	 * @Description: 实时计算距离价格 
	 * @param reqRealTimeCalculationDTO 客户端请求Bean
	 * @author YHQ 
	 * @since V2.5.7
	 * @return ResRealTimeCalculationDTO 实时计算距离价格 响应Bean
	 * 
	 */
	@Override
	public ResRealTimeCalculationDTO realTimeCalculation(ReqRealTimeCalculationDTO reqRealTimeCalculationDTO) {
		
		return calculateService.realTimeCalculation(reqRealTimeCalculationDTO);
	}

}
